export const types = [
    {
      label: '风场',
      value: 'wind_speed',
      unit: 'm/s',
    },
    {
      label: '温度',
      value: 'temperature',
      unit: '℃',
    },
    {
      label: '湿度',
      value: 'humidity',
      unit: '%',
    },
    {
      label: '降水',
      value: 'rain1h',
      unit: 'mm',
    },
    {
      label: '气压',
      value: 'pressure',
      unit: 'hPa',
    }
  ];
  
  export const imagesName = ['24小时降水量', '8时温度', '清远', '24小时最高温度', '24小时最低温度', '汕头'];
  
  export const legendColors = {
    'wind_speed': {
      isImage: true,
      icons: [
        // { id: 'speed0', url: './assets/images/icons/barb_0-1m_s.png', label: '0-1m/s' },
        { id: 'speed1', url: require('@/assets/images/icons/barb_1-2m_s.png'), label: '0-2m/s' },
        { id: 'speed2', url: require('@/assets/images/icons/barb_2-4m_s.png'), label: '2-4m/s' },
        { id: 'speed3', url: require('@/assets/images/icons/barb_4-6m_s.png'), label: '4-6m/s' },
        { id: 'speed4', url: require('@/assets/images/icons/barb_6-8m_s.png'), label: '6-8m/s' },
        { id: 'speed5', url: require('@/assets/images/icons/barb_8-10m_s.png'), label: '8-10m/s' },
        { id: 'speed6', url: require('@/assets/images/icons/barb_10-12m_s.png'), label: '10-12m/s' },
        { id: 'speed7', url: require('@/assets/images/icons/barb_12-14m_s.png'), label: '12-14m/s' },
        { id: 'speed8', url: require('@/assets/images/icons/barb_14-16m_s.png'), label: '14-16m/s' },
        { id: 'speed9', url: require('@/assets/images/icons/barb_16-18m_s.png'), label: '16-18m/s' },
        { id: 'speed10', url: require('@/assets/images/icons/barb_18-20m_s.png'), label: '18-20m/s' },
        { id: 'speed11', url: require('@/assets/images/icons/barb_20-22m_s.png'), label: '20-22m/s' },
        { id: 'speed12', url: require('@/assets/images/icons/barb_22+m_s.png'), label: '> 22m/s' },
      ],
      colors: [
        // { id: 'speed0', url: './assets/images/icons/barb_0-1m_s.png', label: '0-1m/s' },
        { id: 'speed1', url: require('@/assets/images/icons/barb_1-2m_s.png'), label: '0-2m/s' },
        { id: 'speed2', url: require('@/assets/images/icons/barb_2-4m_s.png'), label: '2-4m/s' },
        { id: 'speed3', url: require('@/assets/images/icons/barb_4-6m_s.png'), label: '4-6m/s' },
        { id: 'speed4', url: require('@/assets/images/icons/barb_6-8m_s.png'), label: '6-8m/s' },
        { id: 'speed5', url: require('@/assets/images/icons/barb_8-10m_s.png'), label: '8-10m/s' },
        { id: 'speed6', url: require('@/assets/images/icons/barb_10-12m_s.png'), label: '10-12m/s' },
        { id: 'speed7', url: require('@/assets/images/icons/barb_12-14m_s.png'), label: '12-14m/s' },
        { id: 'speed8', url: require('@/assets/images/icons/barb_14-16m_s.png'), label: '14-16m/s' },
        { id: 'speed9', url: require('@/assets/images/icons/barb_16-18m_s.png'), label: '16-18m/s' },
        { id: 'speed10', url: require('@/assets/images/icons/barb_18-20m_s.png'), label: '18-20m/s' },
        { id: 'speed11', url: require('@/assets/images/icons/barb_20-22m_s.png'), label: '20-22m/s' },
        { id: 'speed12', url: require('@/assets/images/icons/barb_22+m_s.png'), label: '> 22m/s' },
      ]
    },
    'temperature': {
      colors: [
        { label: '≤ -6℃', color: '#330D80' },
        { label: '-6~-2℃', color: '#5440B6' },
        { label: '-2~2℃', color: '#4D66D2' },
        { label: '2~6℃', color: '#4F97E1' },
        { label: '6~8℃', color: '#6CC6EC' },
        { label: '8~10℃', color: '#ABF7EB' },
        { label: '10~12℃', color: '#EEFDCA' },
        { label: '12~14℃', color: '#FCF2AC' },
        { label: '14~16℃', color: '#FCC865' },
        { label: '16~18℃', color: '#FA9200' },
        { label: '20~22℃', color: '#ED7D31' },
        { label: '22~26℃', color: '#F05D04' },
        { label: '> 26℃', color: '#B81C41' },
      ]
    },
    'humidity': {
      colors: [
        { label: '≤ 10', color: '#d50637' },
        { label: '10~20', color: '#e70000' },
        { label: '20~30', color: '#fc2603' },
        { label: '30~40', color: '#f74f14' },
        { label: '40~50', color: '#f9fad5' },
        { label: '50~60', color: '#eefdca' },
        { label: '60~70', color: '#4349c9' },
        { label: '70~80', color: '#5440b6' },
        { label: '80~90', color: '#4621a4' },
        { label: '90~100', color: '#330d80' },
        { label: '> 100', color: '#080000' }
      ]
    },
    'rain1h': {
      colors: [
        { label: '0~1', color: '#ffffff' },
        { label: '1~9.9', color: '#A6F28F' },
        { label: '10~24.9', color: '#3DBA3D' },
        { label: '25~49.9', color: '#61B8FF' },
        { label: '50~99.9', color: '#0000FF' },
        { label: '100~250.0', color: '#FA00FA' },
        { label: '> 250.0', color: '#800040' },
      ]
    },
    'pressure': {
      colors: [
        { label: '≤ 983', color: '#330D80' },
        { label: '983~988', color: '#5440B6' },
        { label: '988~993', color: '#4D66D2' },
        { label: '993~998', color: '#4F97E1' },
        { label: '998~1003', color: '#6CC6EC' },
        { label: '1003~1008', color: '#ABF7EB' },
        { label: '1008~1013', color: '#EEFDCA' },
        { label: '1013~1018', color: '#FCF2AC' },
        { label: '1018~1023', color: '#FCC865' },
        { label: '> 1023', color: '#FA9200' },
      ]
    }
  }
  export const typesRenderer = {
    'wind_speed': {
      layer: {
        type: 'symbol',
        minZoom: 1,
        paint: {
          // 'text-color': 'rgb(255,255,255)',
          // 'text-halo-color': 'rgb(0,0,0)',
          // 'text-halo-width': 1,
        },
        layout: {
          'icon-image': [
            'step',
            ['to-number', ['get', 'wind_speed']],
            // 'speed0', 1.000001,
            'speed1', 2.000001,
            'speed2', 4.000001,
            'speed3', 6.000001,
            'speed4', 8.000001,
            'speed5', 10.000001,
            'speed6', 12.000001,
            'speed7', 14.000001,
            'speed8', 16.000001,
            'speed9', 18.000001,
            'speed10', 20.000001,
            'speed11', 22.000001,
            'speed12'
          ],
          'icon-rotate': ['get', 'wind_direction'],
          'icon-size': .55,
          'icon-allow-overlap': true,
          'icon-ignore-placement': true,
          // 'text-field': ['get', 'wind_speed'],
          // 'text-anchor': 'bottom',
          // 'text-offset': [0, -1.5],
          // 'text-justify': 'auto',
          // 'text-size': 14,
        },
      }
    },
    'temperature': {
      layer: {
        type: 'circle',
        minZoom: 1,
        paint: {
          'circle-color': [
            'step',
            ['to-number', ['get', 'temperature']],
            '#330D80', -6.000001,
            '#5440B6', -2.000001,
            '#4D66D2', 2.000001,
            '#4F97E1', 6.000001,
            '#6CC6EC', 8.000001,
            '#ABF7EB', 10.000001,
            '#EEFDCA', 12.000001,
            '#FCF2AC', 14.000001,
            '#FCC865', 16.000001,
            '#FA9200', 18.000001,
            '#ED7D31', 20.000001,
            '#F05D04', 22.000001,
            '#FC2603', 26.000001,
            '#B81C41'
          ],
          'circle-stroke-width': 1,
          'circle-stroke-color': '#000000'
        },
        layout: {}
      }
    },
    'humidity': {
      layer: {
        type: 'circle',
        minZoom: 1,
        paint: {
          'circle-color': [
            'step',
            ['to-number', ['get', 'humidity']],
            '#d50637', 10.000001,
            '#e70000', 20.000001,
            '#fc2603', 30.000001,
            '#f74f14', 40.000001,
            '#f9fad5', 50.000001,
            '#eefdca', 60.000001,
            '#4349c9', 70.000001,
            '#5440b6', 80.000001,
            '#4621a4', 90.000001,
            '#330d80', 100.000001,
            '#080000'
          ],
          'circle-stroke-width': 1,
          'circle-stroke-color': '#000000'
        },
        layout: {}
      }
    },
    'rain1h': {
      layer: {
        type: 'circle',
        minZoom: 1,
        paint: {
          'circle-color': [
            'step',
            ['to-number', ['get', 'rain1h']],
            '#ffffff', 1.000001,
            '#A6F28F', 9.900001,
            '#3DBA3D', 24.900001,
            '#61B8FF', 49.900001,
            '#0000FF', 99.900001,
            '#FA00FA', 250.000001,
            '#800040'
          ],
          'circle-stroke-width': 1,
          'circle-stroke-color': '#000000'
        },
        layout: {}
      }
    },
    'pressure': {
      layer: {
        type: 'circle',
        minZoom: 1,
        paint: {
          'circle-color': [
            'step',
            ['to-number', ['get', 'pressure']],
            '#330D80', 983.000001,
            '#5440B6', 988.000001,
            '#4D66D2', 993.000001,
            '#4F97E1', 998.000001,
            '#6CC6EC', 1003.000001,
            '#ABF7EB', 1008.000001,
            '#EEFDCA', 1013.000001,
            '#FCF2AC', 1018.000001,
            '#FCC865', 1023.000001,
            '#FA9200'
          ],
          'circle-stroke-width': 1,
          'circle-stroke-color': '#000000'
        },
        layout: {}
      }
    },
    'label': {
      layer: {
        type: 'symbol',
        minZoom: 1,
        paint: {
          'text-color': 'rgb(255,255,255)',
          'text-halo-color': 'rgb(0,0,0)',
          'text-halo-width': 1,
        },
        layout: {
          'text-field': ['get', 'wind_speed'],
          'text-anchor': 'bottom',
          'text-offset': [0, -0.5],
          'text-justify': 'auto',
          'text-size': 14,
        },
      }
    }
  };
  
  export const popupTemplate = [
    { label: '站点', field: 'station_name' },
    { label: '所属城市', field: 'city' },
    { label: '观测时间', field: 'update_time', dataType: 'dateTime' },
    { label: '风速', field: 'wind_speed', unit: 'm/s' },
    { label: '风向', field: 'wind_direction' },
    { label: '气温', field: 'temperature', unit: '℃' },
    { label: '湿度', field: 'humidity', unit: '%' },
    { label: '降水', field: 'rain1h', unit: 'mm' },
    { label: '气压', field: 'pressure', unit: 'hPa' },
  ];
  